package JavaShengSai;

import java.util.Scanner;

/**
 * 13. 既约分数
 * https://www.lanqiao.cn/problems/593/learning/?page=1&first_category_id=1&tags=2020,%E7%9C%81%E8%B5%9B&tag_relation=intersection
 */
public class Main13 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int sum = 0;
        for(int i = 1;i <= 2020;i++) {
            for(int j = 1;j <= 2020;j++) {
                if(gcb(i,j) == 1) {
                    sum++;
                }
            }
        }
        System.out.println(sum);
        scan.close();
    }
    public static int gcb(int a,int b) {
        if(a % b == 0) {
            return b;
        }else {
            return gcb(b,a % b);
        }
    }
}
